import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
   //mode: 'history',
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      if (from.meta.keepAlive) {
        from.meta.savedPosition = document.body.scrollTop
      }
      return { x: 0, y: to.meta.savedPosition || 0 }
    }
  },
  routes: [{
    path: '/',
    name: 'layout',
    component: () =>
      import ("@/views/layout/menu"),
    redirect: "home",
    children: [{
      path: "home",
      component: () =>
        import ("@/views/home/index"),
      name: "home",
      meta:{scorllId:"layoutcentent"}
      
    }, {
      path: "category",
      component: () =>
        import ("@/views/category/index"),
      name: "category",
      scorllId:"layoutcentent"
    }, {
      path: "personCenter",
      component: () =>
        import ("@/views/personCenter/index"),
      name: "personCenter"
    }]
  }, {
    path: '/commodityDetail',
    name: 'commodityDetail',
    component: () =>
      import ("@/views/commodityDetail/index"),
  }, {
    path: '/conoforder',
    name: 'conoforder',
    component: () =>
      import ("@/views/conOfOrder/index"),
  }, {
    path: '/order',
    name: 'order',
    component: () =>
      import ("@/views/order/index"),
  }, {
    path: '/orderDetail',
    name: 'orderDetail',
    component: () =>
      import ("@/views/orderDetail/index"),
  }, {
    path: '/address',
    name: 'address',
    component: () =>
      import ("@/views/address/index"),
  }, {
    path: '/addressAddOrEdit',
    name: 'addressAddOrEdit',
    component: () =>
      import ("@/views/address/addOrEdit"),
  }, {
    path: '/bingPhone',
    name: 'bingPhone',
    component: () =>
      import ("@/views/personCenter/bingPhone"),
  }, {
    path: '/invitation',
    name: 'invitation',
    component: () =>
      import ("@/views/personCenter/invitation"),
  }, {
    path: '/complete',
    name: 'complete',
    component: () =>
      import ("@/views/result/complete"),
  }, {
    path: '/logistics',
    name: 'logistics',
    component: () =>
      import ("@/views/logistics/index"),
  }]
})
